package com.foreknow.demo14;

/**
 * throw 明确异常(人为制造异常)
 */
public class ExceptionDemo6 {
    public  int add(int a,int b) throws Exception {
        System.out.println(5/0);
        if(a < 0 || b < 0) {
            Exception e = new Exception();
            throw e;
        }
        return a + b;
    }

    public static void main(String[] args) {
        ExceptionDemo6 demo6 = new ExceptionDemo6();
        try {
            demo6.add(-1,-2);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("111111111111111111111111111");
    }
}
